#define _CRT_SECURE_NO_WARNINGS 1

#include<stdio.h>
void Judge_cap(char x[]);//函数声明
void Sort(char x[]);//函数声明
void Print_arrary(char x[]);//函数声明

int count1 = 0;//大写字母个数
int count2 = 0;//小写字母个数

int main()
{
	char arr[80] = { '0' };
	printf("Please input string:\n");
	gets(arr);//输入字符串
	Judge_cap(arr);//统计大小写字母即个数
	Sort(arr);//排序字符
	Print_arrary(arr);//打印排序后的字符串
	return 0;
}
void Judge_cap(char x[])//统计大小写字母
{
	int i = 0;
	int sz = strlen(x);
	printf("大写字母为：\n");
	for (i = 0; i < sz - 1; i++)
	{
		if (x[i] >= 'A' && x[i] <= 'Z')
		{
			printf("%c", x[i]);
			count1++;
		}
	}
	printf("\n小写字母为：\n");
	for (i = 0; i < sz - 1; i++)
	{
		if (x[i] >= 'a' && x[i] <= 'z')
		{
			printf("%c", x[i]);
			count2++;
		}
	}
	printf("\n大写字母的个数为：%d\n", count1);
	printf("小写字母的个数为：%d\n", count2);
}
void Sort(char x[])//冒泡法排序字符
{
	int i = 0;
	int j = 0;
	int t = 0;
	int sz = strlen(x);
	for (i = 0; i < sz - 1; i++)
	{
		for (j = 0; j < sz - 1 - i; j++)
		{
			if (x[j] > x[j + 1])
			{
				t = x[j];
				x[j] = x[j+1];
				x[j + 1] = t;
			}
		}
	}
}
void Print_arrary(char x[])//打印排序后的字符
{
	printf("%s", x);
}